<template>
	<view class="contation">
		<view class="notice_list">
			<view class="list" v-for="(item,index) in noticeList" :key="index" @click="go_url('/pages/NotificationMessage/NotificationMessage?id='+item.id)" v-if="noticeList.length!=0">
				<view class="title flex flex-align flex-bt">
					<view class="left flex flex-align">
						<!-- <tui-icon name="news" :size="28" color="#333"></tui-icon> -->
						<view class="text_one">{{item.name}}</view>
					</view>
					<view class="time flex flex-align">
						<view class="">{{item.create_at}}</view>
						<tui-icon name="arrowright" :size="20" color="#bebebe"></tui-icon>
					</view>
				</view>
				<!-- <view class="content text_one">
					{{item.title}}
				</view> -->
			</view>
			<view class="empty-box" v-if="noticeList.length==0">
				<image src="/static/ic_nodata.png" mode=""></image>
				<view class="">暂无数据</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		
		data() {
			return {
				title: 'Hello',
				page:1,
				noticeList:[]
			}
		},
		
		onLoad() {
			this.getnotice()
		},
		onReachBottom() {
			this.page++
			this.getnotice()
		},
		onPullDownRefresh() {
			let that = this
			setTimeout(function () {
				that.page=1
				that.noticeList=[]
				that.getnotice()
				uni.stopPullDownRefresh();
			}, 1000);
		},
		
		methods: {
			go_url(e){
				this.tui.href(e)
			},
			getnotice(){
				let that = this
				that.tui.request("api.data/business", "POST", {page:that.page}, false, false, false).then((res) => {
					if(res.code==1){
						that.noticeList = that.noticeList.concat(res.data.list)
					}
				}).catch((res) => {
					
				})
			},
		}
	}
</script>

<style lang="scss">
	page{background: #fff;}
	.notice_list{padding:10rpx 20rpx 30rpx;
		.list{border-radius:20rpx;padding: 20rpx;border: 1px solid #eee;margin-bottom: 20rpx;
			.left{
				image{width: 40rpx;height: 40rpx;margin-right: 10rpx;}
				.text_one{color: #000;font-size: 30rpx;width: 320rpx;}
			}
			.time{
				color: #888888;font-size: 28rpx;
			}
			.content{margin-top: 20rpx;color: #888888;}
		}
	}
</style>